home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
projectile.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
3KB
|
595 lines
int Initialize(string type)
{
global int state = 0;
global real explodeTime = 4.0;
global int hitValue = 10;
global real gEndTime = 0.0;
global real gSmokeTime = 0.20;
global int gSmokeTrail = 0;
global real gMass = 5.0;
SetCollidableProperties(thisObject,1,0);
SetElas(thisObject,0.0);
SetStyle(thisObject,3);
wakeupTime = -1.0;
Reset();
return 0;
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int Fire(int flag)
{
real time ;
time = GetTime(thisObject);
if (state == 0)
{
state = 2;
SetCollidableProperties(thisObject,1,1);
SetStyle(thisObject,0);
PlaySound(thisObject,8);
SetOldPos(thisObject);
wakeupTime = time + 0.05;
gEndTime = time + explodeTime;
}
return 0;
}
int Explosion(int param)
{
real time ;
time = GetTime(thisObject);
state = 4;
KillEFX(thisObject,gSmokeTrail);
gSmokeTrail = 0;
LaunchEFX(thisObject,2,0);
Explode(thisObject,hitValue,15.0);
PlaySound(thisObject,26,gMass);
MakeDecal(thisObject,1,1);
SetCollidableProperties(thisObject,0,0);
SetStyle(thisObject,4);
wakeupTime = time + 1.0;
return 0;
}
int Colliders(string dummy)
{
if (state == 2)
{
Explosion(0);
}
return 0;
}
int Collidants(string dummy)
{
if (state == 2)
{
Explosion(0);
}
return 0;
}
int TimedEvent(int input)
{
real time;
time = GetTime(thisObject);
if (state == 2)
{
if (time > gEndTime)
{
wakeupTime = time;
state = 3;
}
else
{
if (gSmokeTrail == 0)
{
gSmokeTrail = LaunchEFX(thisObject,1,0);
SetOldPos(thisObject);
}
else
{
MoveEFX(thisObject,gSmokeTrail,1);
SetOldPos(thisObject);
}
wakeupTime = time + gSmokeTime;
}
}
else if (state == 3)
{
Explosion(0);
}
else if (state == 4)
{
Reset();
Remove(thisObject);
wakeupTime = -1.0;
}
else
wakeupTime = -1.0;
return 0;
}
int Reset()
{
state = 0;
return 0;
}